package org.example.petsystem.service.impl;

import org.example.petsystem.entity.ResultBody;
import org.example.petsystem.mapper.NoticeMapper;
import org.example.petsystem.service.NoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class NoticeServiceimpl implements NoticeService {
    @Autowired
    private NoticeMapper noticeMapper;
    @Override
    public ResultBody sendNotice(Map<String,Object> map){
        if(noticeMapper.sendNotice(map)>0)
        {
            return new ResultBody(200,"发送成功",true);
        }
        else
            return new ResultBody(400,"发送失败",false);
    }
    @Override
    public ResultBody displayNotice(){
        if(!noticeMapper.displayNotice().isEmpty())
        return new ResultBody(200,"查询成功",noticeMapper.displayNotice(),noticeMapper.displayNotice().size());
        else
            return new ResultBody(400,"查询失败",false);
    }
    @Override
    public ResultBody DelNotice(Map<String,Object> map){
        if(noticeMapper.DelNotice(map)>0)
            return new ResultBody(200,"删除成功",true);
        else
            return new ResultBody(400,"删除成功",false);
    }
}
